package com.example.springboot.demo.conf;

import javafx.scene.media.VideoTrack;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.annotation.SessionAttributesHandler;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfigurer implements WebMvcConfigurer {

    //拦截器
    @Override
    public void addInterceptors (InterceptorRegistry registry){
        registry.addInterceptor(new SessionHandlerInterceptor()).addPathPatterns("/test/**");
        System.out.println("连接器");
    }

    @Override
    public void addCorsMappings(CorsRegistry registry){
        registry.addMapping("/**").allowedMethods("post","get").allowedOrigins();
    }
}
